#include "RtpPacket.hpp"
#include "ParserPacket.hpp"
#include "RtpPacketUtil.hpp"
#include "common/HiCommonLog.hpp"

namespace Hi {
static uint8_t ClonedPacketBuffer[RTP_BUFFER_SIZE];
					  
RtpPacket* hi_RtpPacket_parse(const uint8_t *data, size_t len) {
	RtpPacket* sourcePpacket = RtpPacketUtil::Parse(data, len);
	if (nullptr == sourcePpacket) {
		return nullptr;
	}
	return sourcePpacket->Clone(ClonedPacketBuffer);
}

void hi_RtpPacket_release(RtpPacket** packet) {
	if (nullptr == *packet) {
		return;
	}
	delete *packet;
	packet = nullptr;
}

const char* hi_RtpPacket_error() {
	return RtpPacketUtil::Error();
}
}